package cn.hicard.risk.dao.bd.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import cn.hicard.risk.dao.BaseDao;
import cn.hicard.risk.entity.BdMerchinfo;

@Repository
public class MerchDaoImpl extends BaseDao<BdMerchinfo> {

	public BdMerchinfo getOne(BdMerchinfo merch) throws Exception {
		
		String hkMerchno = merch.getHmId();
		BdMerchinfo result = null;
	
		// 其次使用应该是唯一的[汇卡商户号]查询
		if(hkMerchno != null){
			List<BdMerchinfo> list = super.findByHql("FROM BdMerchinfo WHERE hmId=?", hkMerchno);
			if(list !=null && list.size() > 0){
				result = list.get(0);
			}
		}
		// 最后还是查不到就返回空[null]喽！
		return result;
	}

/*	@Override
	public List<BdMerchinfo> findList(BdMerchinfo merch) throws Exception {
		String hql = "FROM BdMerchinfo WHERE 1=1 AND getTicket=?";
		// 交易是否调单
		String iswatch = merch.getGetTicket();
		return super.findByHql(hql, iswatch);
	}

	@Override
	public List<String> findPeriodList(BdMerchinfo merch) throws Exception {
		String hql = "SELECT id FROM BdMerchinfo WHERE 1=1 AND period=?";
		String period = merch.getPeriod();
		return super.findFieldByHql(hql,period);
	}*/

}
